package com.xsq.bo;

import java.util.ArrayList;
import java.util.List;

public class ServerInfos {

	private List<ServerInfo> servers = new ArrayList<ServerInfo>();

	public List<ServerInfo> getServers() {
		return servers;
	}

	public void setServers(List<ServerInfo> servers) {
		this.servers = servers;
	}

	public void updateServer(String name, String status) {

		boolean has = false;
		if (name == null) {
			return;
		}

		for (ServerInfo info : servers) {
			if (info.getServer().equals(name)) {
				has = true;
				info.setStatus(status);
				break;
			}
		}
		if (!has) {
			// 新增
			ServerInfo info = new ServerInfo();
			info.setServer(name);
			info.setStatus(status);
			servers.add(info);

		}
	}

}
